﻿#include "MobileDlg.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <widgets/SImageButton.h>
#include "core/ImageMgr.h"
#include "core/StyleMgr.h"
#include "core/qrencode/QRcodeImage.h"

MobileDlg::MobileDlg(QWidget* parent /*= nullptr*/)
	: SPopupWindow(parent)
{
	setFixedSize(512, 334);
	setTitle(tr("关于qeubee"));

	QVBoxLayout* mainLayout = contentLayout();
	mainLayout->addSpacing(20);

	//提示
	QLabel* userLabel = new QLabel(tr("扫描二维码下载手机版qeubee"), this);
	mainLayout->addWidget(userLabel, 0, Qt::AlignHCenter);
	mainLayout->addSpacing(25);
	
	//二维码
	QLabel* imageLabel = new QLabel(this);
	imageLabel->setMinimumHeight(139);
	QRcodeImage qrcode("https://qbweb.idbhost.com/basehtml/mobile/app/download.html");
	QImage* image = qrcode.getImage();
	if (image) {
		imageLabel->setPixmap(QPixmap::fromImage(image->scaled(139,139)));
	}
	mainLayout->addWidget(imageLabel, 0, Qt::AlignHCenter);
	mainLayout->addSpacing(60);


	//支持信息
	QString information = QString("<a href=\"\"><font style='font-size:12px'; color=#%1>%2</font></a>")
		.arg(StyleMgr::instance().color("SupportingWord").rgb(), 0, 16)
		.arg(tr("支持Android 4.4以上及ios 13.0以上版本"));
	QLabel* version = new QLabel(information, this);
	mainLayout->addWidget(version,0, Qt::AlignHCenter);
	mainLayout->addSpacing(5);

	//备案、版权信息
	QHBoxLayout* companyInfoLayout = new QHBoxLayout();
	companyInfoLayout->addStretch();
	QString str = QString("<a href=\"\"><font style='font-size:12px'; color=#%1>%2</font></a>")
		.arg(StyleMgr::instance().color("SupportingWord").rgb(), 0, 16)
		.arg(tr("浙金信备〔2021〕2号"));
	QLabel* cert = new QLabel(str, this);
	QLabel* copyright = new QLabel(QString("<font style='font-size:12px'; color=#%1>%2</font>")
		.arg(StyleMgr::instance().color("SupportingWord").rgb(), 0, 16)
		.arg(tr("Copyright ©2013-2019 SUMSCOPE L.P. All Rights Reserved.")), this);
	companyInfoLayout->addWidget(cert);
	companyInfoLayout->addSpacing(5);
	companyInfoLayout->addWidget(copyright);
	companyInfoLayout->addStretch();
	mainLayout->addLayout(companyInfoLayout);
	mainLayout->addStretch();
}